pub fn new_birthday_probability(n: u32) -> f64 {
    return birthday_paradox_probability(n as usize);
}

fn birthday_paradox_probability(n: usize) -> f64 {
    if n < 2 {
        panic!("人数必须大于等于2");
    }

    let mut prob_different = 1.0;
    for i in 1..=n {
        prob_different *= (365 - (i - 1)) as f64 / 365.0;
    }

    let prob_same = 1.0 - prob_different;
    (prob_same * 10000.0).round() / 10000.0 // 保留四位小数
}
